.PHONY:clean
myArgs = -Wall -g
inc_path= ./inc
src = $(wildcard ./src/*.c)    # wildcard意义把该目录下的*.c赋值给src   ./src/add.c  ./src/sum.c
obj = $(patsubst ./src/%.c,./obj/%.o,$(src))    # 函数意义，把$(src)下 add.c(%.c) 赋值给 add.o(%.o)  ./obj/add.o
#all:main.o add.o sub.o           # main.o foo.o依赖于main.o首先执行下面的main.o:main.c.....
all: main.out
main.out: $(obj)
#	gcc main.o add.o sub.o -o main
#	gcc $(obj) -o main
	gcc $^ -o $@ $(myArgs)
#  %.o:%.c     #模式规则
$(obj):./obj/%.o:./src/%.c                      ##使用静态模式规则
	gcc -c $< -o $@ $(myArgs) -I $(inc_path)
clean:
#	rm *.o
	rm $(obj)